<?php
/**
 * @file class.runtime.php
 * @package V2
 * @subpackage 
 * @version $id: 0.1 UTF-8 2009-8-16 下午03:02:38 $
 * @author LD King (mifunny.info)
 * @copyright Copyright (c) 2007 - 2009 MiFunny China Inc. (http://mifunny.info)
 * 计算页面执行时间的类
 */

class Runtime{
    private $StartTime = 0;
    private $StopTime = 0;
 
    public function get_microtime(){
        list($usec, $sec) = explode(' ', microtime());
        return ((float)$usec + (float)$sec);
    }
 
    public function start(){
        $this->StartTime = $this->get_microtime();
    }
 
    public function stop(){
        $this->StopTime = $this->get_microtime();
    }
 
    public function spent(){
        return round(($this->StopTime - $this->StartTime) * 1000, 1);
    }
 
}
?>